﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace G.APITest.ChildWindows
{
    public partial class LoginChildWindow : ChildWindow
    {
        public LoginChildWindow()
        {
            InitializeComponent();
        }

        private void OKButton_Click(object sender, RoutedEventArgs e)
        {
            //this.DialogResult = true;
            GloabalData.Instance.SampleClient.Execute(new Service.API.Request.User.LoginRequest() { Email = txtEmail.Text, Password = txtPWD.Password }, (c) =>
            {
                if (c.IsOK)
                {
                    GloabalData.Instance.UserInfo = c.ResponseData;
                    this.DialogResult = true;
                }
                else
                {
                    MessageBox.Show(c.Msg);
                }
            });
        }

        private void CancelButton_Click(object sender, RoutedEventArgs e)
        {
            this.DialogResult = false;
        }
    }
}

